package com.hanson.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.hanson.common.api.CommonResult;
import com.hanson.common.api.ResultCode;
import com.hanson.mapper.DataCountMapper;
import com.hanson.pojo.vo.DataCount;
import com.hanson.service.IDataCountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @classname: DataCountServiceImpl
 * @author: Hanson
 * @create: 2021/01/25
 **/
@Slf4j
@Service
public class DataCountServiceImpl implements IDataCountService {

    @Autowired
    private DataCountMapper dataCountMapper;


    @Override
    public Object getDataCounts() {
        List<DataCount> dataCounts = dataCountMapper.doGetDmallCount();
        if (CollectionUtil.isEmpty(dataCounts)){
            return new CommonResult<>(ResultCode.FAILED,null,"商城信息统计失败！");
        }
        return dataCounts;
    }
}
